home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / programming / amos / amossible / spritesnbobs / displaysprite.amos / displaysprite.amosSourceCode < prev    next >
Encoding:
AMOS Source Code  |  1980-05-16  |  3.1 KB  |  55 lines

  1. '*********************SPRITES-WHO NEEDS EM?-By Mark Wickson**********************  
  2. Rem Personally,I hate using sprites,because Bobs are so much easier to use,
  3. Rem even though this is the way you're supposed to display Sprites,it  
  4. Rem looks decidedly odd,as you'll see. 
  5. Rem After you have loaded the sprites in the usual way(See elsewhere for 
  6. Rem details of loading files),you have to use the "Get Sprite Palette" 
  7. Rem command to make sure they are the colours you defined them.
  8. Rem next we place the sprite of our choice on screen,theres no limitation
  9. Rem to the number of sprites,only that you can't have more than 8 at the 
  10. Rem same horizontal position.
  11. Rem The first number after the word Sprite is the Sprite number,this is
  12. Rem important if you're going to have more than one sprite on screen at
  13. Rem a time,this is so you can have several objects on screen at a time 
  14. Rem but make each one do different things-So each sprite you have on screen
  15. Rem must have a different number-Its easiest to increase the number by 1 
  16. Rem for every new sprite.so if you were going to use sprite 1 you'd write: 
  17. Rem Sprite 1,
  18. Rem The next number is the Sprites horizontal position on the current screen,  
  19. Rem so for this current screen the number can be anything between 0 and  
  20. Rem 320-If you wanted to put it on the right hand side,you'd set it around 
  21. Rem 300,if you wanted it to be on the left hand side,you'd set it around 
  22. Rem 20,and the centre is roughly 150-But you can put it any where within 
  23. Rem these limits,lets imagine we want it in the centre,so we type: 
  24. Rem Sprite 1,150,
  25. Rem The next number is the vertical position of the sprite on the current
  26. Rem screen,so for this current screen the number can be anything between 
  27. Rem 0 and 256-If you want it near the top,you'd set it around 10,if you
  28. Rem wanted it in the centre,110 is approximately right,and the bottom of 
  29. Rem the screen would be around 230,but as above,you're free to set it
  30. Rem anywhere within the limits of the screen.Like this:
  31. Rem Sprite 1,150,110,
  32. Rem The final number is the IMAGE number of the Sprite,don't confuse this
  33. Rem with the Sprite number-This is what affects the visual aspect of the 
  34. Rem sprite-Not the sprite itself(In the Sprite bank maker,you aren't actually
  35. Rem defining the Sprites as such,but the images that ANY of them can have) 
  36. Rem If you have created 10 images in your Sprite bank and want to use  
  37. Rem the first image for the first sprite,you'd write:
  38. Rem Sprite 1,150,110,1 
  39. Rem But if you wanted sprite 1 to use the fifth image in the bank,you'd write: 
  40. Rem Sprite 1,150,110,5 
  41. Rem So you can use any image number that you want with any sprite-You can even 
  42. Rem have several different sprites with the same image number. 
  43. Rem In our example we use the "Wait Vbl" command which makes AMOS wait until 
  44. Rem the screen has `drawn' itself before progressing-Because our program is so 
  45. Rem small if you took that instruction the sprite wouldn't even appear-You 
  46. Rem don't have to include this command in larger programs or ones that have  
  47. Rem commands after the "Sprite" command. 
  48. Screen Open 0,320,256,16,Lowres
  49. Flash Off 
  50. Curs Off 
  51. Cls 0
  52. Load "ATTBG:JUMP.Abk"
  53. Get Sprite Palette 
  54. Sprite 1,150,110,1
  55. Wait Vbl